[PHP] fix: preserve queued datagrams under receive overflow#859
Merged
brandonpayton merged 6 commits intoJul 11, 2026
Merged
Conversation
This was referenced Jul 10, 2026
When the fixed internal AF_INET/AF_INET6 receive queue is full, discard the incoming datagram and preserve the order of datagrams already accepted. Keep AF_UNIX on its existing bounded path because reliable Unix datagrams need a separate sender-backpressure design. This changes socket overflow semantics without adding structural ABI entries. It is quarantined in Batch 2 for the planned ABI 16-to-17 semantic reconciliation.
Unix datagrams are reliable, so a full receive queue now returns EAGAIN into the host blocking-retry path instead of discarding a message. Connected senders also stop advertising POLLOUT until their peer drains space.
f7135df to
6901aac
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contract: preserve accepted queues and expose reliable backpressure
IPv4/IPv6 UDP overflow is lossy, but it must drop the incoming datagram rather than evicting and reordering data already accepted by the receive queue. AF_UNIX datagrams are reliable: a full receive queue must backpressure the sender, and capacity or endpoint-state changes must wake blocked sends and readiness waits.
What changed
EAGAINfor a full AF_UNIX datagram queue and route blocking sends through the host retry path;O_NONBLOCKandMSG_DONTWAITremain immediate.EPERM, andPOLLOUTis suppressed only when the next send would actually block.EPIPEplusSIGPIPEunlessMSG_NOSIGNALis used; connect, dequeue, shutdown, last-close, and pathname unlink emit a broad datagram send-state wake.SO_RCVBUFboundary and AF_UNIX reliability semantics.POLLOUTwakeups.Review changes beyond the original PR
The original one-commit change only replaced oldest-entry eviction with an incoming drop. Rebase review found that the same queue was shared by reliable AF_UNIX datagrams and that the host retry loop restarted finite readiness timeouts. The added commits separate lossy UDP tail-drop from reliable AF_UNIX backpressure, repair connected-peer and shutdown/close state transitions, make the host wake/deadline path bounded, and exercise the behavior through the guest ABI on Node and Chromium.
Review view
Recommended for Batch 2. The repaired behavior matches the platform's POSIX-first queue model and keeps the remaining machine-wide AF_UNIX datagram routing gap explicit rather than pretending cross-process delivery works.
ABI
The structural ABI snapshot has no #859-specific delta, but the new kernel-to-host datagram wake bit is semantic ABI state not represented in the snapshot. This PR must remain in Batch 2's quarantined ABI work and be covered by the planned aggregate ABI 16 -> 17 reconciliation before the batch can merge to main. The current snapshot check also sees the already-quarantined additive
kernel_pipe_has_readersexport from #755.Validation
cargo test -p kandelo --target aarch64-apple-darwin --lib: 1,015 passed, 0 failed.datagram-wakeup,readiness-deadline): 2 files, 3 tests passed.cd host && npm run build: passed (existing CJSimport.metawarnings only).__wasm_posix_vm_interrupt_after) and the absent wasm64 hello artifact, not these datagram tests.-Wall -Wextra -Werror: passed.queue-overflow-tail-dropandunix-dgram-queue-backpressure, 2/2 passed.queue-overflow-tail-drop281 ms;unix-dgram-queue-backpressure1,543 ms).scripts/check-abi-version.sh: snapshot/header/TypeScript bindings in sync; only the existing additive [PHP] fix: preserve orderly TCP close across bridges #755 export is reported../run.sh browserwas not used because the current Batch-2 aggregate has the known [PHP] Establish a reproducible PHPT conformance surface #740/[PHP] fix: keep host/browser runtime and SharedFS state coherent #757 browser-startup blocker; the exact guest binaries were nevertheless run in real Chromium.Known pre-existing host limitations not claimed as fixed here: retry-map keys can collide across processes,
select(0, ...)does not yet model signal interruption, andepoll_pwaitdoes not yet implement its temporary signal-mask contract.